﻿using UnityEngine;
using Verse;

[StaticConstructorOnStartup]
public class WeatherOverlay_PaperCoinRain : WeatherOverlayDualPanner
{
    //private static readonly int PaperTex = Shader.PropertyToID("_MainTex");
    private static readonly Material PaperCoinMat =
        MaterialPool.MatFrom("Weather/PaperCoinRain", ShaderDatabase.MoteGlow);

    private Vector2 pan1, pan2;

    public WeatherOverlay_PaperCoinRain()
    {
        this.worldOverlayMat = PaperCoinMat;
        this.worldOverlayPanSpeed1 = 0.002f;
        this.worldPanDir1 = new Vector2(-0.25f, -1f).normalized;

        this.worldOverlayPanSpeed2 = 0.003f;
        this.worldPanDir2 = new Vector2(-0.24f, -1f).normalized;
    }

    //public override void TickOverlay(Map map, float lerpFactor)
    //{
    //    if (worldOverlayMat != null)
    //    {
    //        pan1 -= worldPanDir1 * (worldOverlayPanSpeed1 * worldOverlayMat.GetTextureScale(PaperTex).x * Find.TickManager.TickRateMultiplier);
    //        worldOverlayMat.SetTextureOffset(PaperTex, pan1);

    //        if (worldOverlayMat.HasProperty("_MainTex2"))
    //        {
    //            pan2 -= worldPanDir2 * (worldOverlayPanSpeed2 * worldOverlayMat.GetTextureScale("_MainTex2").x * Find.TickManager.TickRateMultiplier);
    //            worldOverlayMat.SetTextureOffset("_MainTex2", pan2);
    //        }
    //    }
    //}
}
